<?php
/**
 * 活动后台投放的卡券
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019-03-28
 * Time: 下午 4:39
 */
namespace Model;

class SponsorCouponMod extends Mod
{
	public function __construct()
	{
		$this->_table = 'kuyuan_vbz_activity_sponsor_coupon';
	}

    /**
     * 获取指定活动投放的卡券列表
     * @param $_activity_id 活动id
     * @return boolean 返回卡券列表
     */
    public function getPutList($_activity_id)
    {
        $_sql = "
            SELECT 
                id,name,icon,use_limit_type,user_number,limit_time,win_odds,edit_time,rule,money
            FROM
                ".tablename($this->_table)."
            WHERE
                activity_id = :activity_id
            AND
                status = 1
            AND
                give_number < number
            ORDER BY
                win_odds DESC
        ";
        return pdo_fetchall($_sql,array('activity_id'=>$_activity_id));
    }

}